import request from '@/config/axios'

// 数据上传 VO
export interface DeviceLatestLogVO {
  id: number // 设备ID
  deviceId: number // 设备ID
  deviceName: string // 设备名称
  deviceKey: string // 设备唯一码
  gatewayId: string // 网关ID
  requestType: string // 类型
  requestBody: string // 发送包内容
  responseBody: string // 响应包内容
  sendStatus: string // 上送状态
  responseStatus: string // 上送成功
}

// 数据上传 API
export const DeviceLatestLogApi = {
  // 查询数据上传分页
  getDeviceLatestLogPage: async (params: any) => {
    return await request.get({ url: `/mqtt/device-latest-log/page`, params })
  },

  // 查询数据上传详情
  getDeviceLatestLog: async (id: number) => {
    return await request.get({ url: `/mqtt/device-latest-log/get?id=` + id })
  },

  // 新增数据上传
  createDeviceLatestLog: async (data: DeviceLatestLogVO) => {
    return await request.post({ url: `/mqtt/device-latest-log/create`, data })
  },

  // 修改数据上传
  updateDeviceLatestLog: async (data: DeviceLatestLogVO) => {
    return await request.put({ url: `/mqtt/device-latest-log/update`, data })
  },

  // 删除数据上传
  deleteDeviceLatestLog: async (id: number) => {
    return await request.delete({ url: `/mqtt/device-latest-log/delete?id=` + id })
  },

  // 导出数据上传 Excel
  exportDeviceLatestLog: async (params) => {
    return await request.download({ url: `/mqtt/device-latest-log/export-excel`, params })
  }
}